For many years, it was widely accepted(1) that electrons confined to two dimensions would adopt an insulating ground state at zero temperature and in zero magnetic field. Application of a strong perpendicular magnetic field changes this picture, resulting(2,3) in a transition from the insulating phase to a metallic quantum Hall state. Unexpectedly, an insulator-to-metal transition was recently observed(4) in high-quality two-dimensional systems at zero magnetic field on changing the charge carrier density. The mechanism underlying this transition remains unknown(5-9). Here we investigate the magnetic-field-driven transition in a two-dimensional gallium arsenide system, which also exhibits(10-12) the poorly understood zero-field transition. We find that, on increasing the carrier density, the critical magnetic field needed to produce an insulator-to-metal transition decreases continuously and becomes zero at the carrier density appropriate to the zero-field transition. Our results suggest that both the finite- and zero-magnetic field transitions share a common physical origin.