Temporally-shaped electron bunches at ultrafast time scales are foreseen to support an array of applications including the development of small-footprint accelerator-based coherent light sources or as probes for, e.g., ultrafast electron-diffraction. We demonstrate a method where a transverselysegmented electron bunch produced via photoemission from a transversely-patterned laser distribution is transformed into an electron bunch with modulated temporal distribution. In essence, the presented transformation enables the mapping of the transverse laser distribution on a photocathode surface to the temporal coordinate and provides a proof-of-principle experiment of the method proposed in Reference [W. S. Graves, et al. Phys. Rev. Lett. 108, 263904 (2012)] as a path toward the realization of compact coherent X-ray sources, albeit at a larger timescale. The presented experiment is validated against numerical simulations and the versatility of the concept, e.g. to tune the current-distribution parameters, is showcased. Although our work focuses on the generation of electron bunches arranged as a temporal comb it is applicable to other temporal shapes.