Second and fourth moments of the charge density and neutron-skin thickness of atomic nuclei