Radiative transitions in charmonium from lattice QCD