Leinster turn on the style in the second half to beat Edinburgh 49-31 in a chaotic Champions Cup last-16 game at the Aviva Stadium.