A relation between the characteristic stellar ages of galaxies and their intrinsic shapes