Dense Molecular Gas around Protostars and in Galactic Nuclei