The first is merely a statement of fact, a description of what they do. It's a narrower sense.
The second is more a philosophical statement, that teaching can be accidental or unintended. It invites an example of what you mean.
One could say, "A hot stove is a very effective teacher." in the second sense, but not the first. (A stove would be anything rather than anyone.)
Or, an abusive, careless, or inspiring person could 'teach' you how to deal with such people, or something about yourself.
The first implies intention, and would be in contrast to the idea that a teacher is only someone who has a certificate to teach, for example.
Both suggest 'teachers' are defined by the effect on the student. The first implies someone teaching informally, or by example, not as their primary role.
The use of 'anyone' makes the second 'definition' much broader and more inclusive.
Did this help?