Dielectric Functions of Semiconductor Nanoparticles from the Optical Absorption Spectrum: The Case of CdSe and CdS