Identifying galaxy mergers in observations and simulations with deep learning