In machine learning, the same algorithm can do both, provided you give it the appropriate data to learn from.
Machine learning can even use only one algorithm to solve to drastically different problem ex. One can play chess and process credit card applications, provided that you gave it a database.