A molecular based continuum approach for the dielectric permittivity of liquids and liquid crystals