Machine learning methods trained on simple models can predict critical transitions in complex natural systems