A new stable procedure to calculate spectral densities from moments