The era of machines and robots have just begun. The future of machine is enormous and is beyond our scope of imagination. Yes, Mechanical Engineers can learn machine learning. You need a lot of programming knowledge though. But you can always learn.
The first and foremost requirement is to have a good grip on a programming language, preferably python as it is easy to learn and its applications are wider than any other language. Python is the lingua franca of Machine Learning.
It is important to have a good understanding of topics like Data structures, Memory management, and classes. Although Python is a very good Language, it alone cannot help you. You will probably have to learn all these languages like C++, R, Python, Java and also work on MapReduce at some point.
Have a look at this blog for more details on understanding the requirements for Python Machine Learning:
https://www.edureka.co/blog/machine-learning-engineer-skills/