Kernel and wavelet density estimators on manifolds and more general metric spaces