Reconstructing solar irradiance from Ca II K observations