If elected, a Labour government would call a fresh Brexit vote within six months, the party has announced.