This video has become quite popular in the past month. Chances are you've already seen it. If so, my apologies, but it's just too funny.
Here's a quick summary for you: cat barks, cat sees owner, cat meows.

Why does the cat bark, I wonder? Does it realize the barking might scare people, and is it just messing with people walking by? If so, smart cat.
And more, since the cat changes its 'woof' to a 'meow' when it realizes it is caught by its owner, does it realize that it's doing something it isn't supposed to do? If so, smart cat.
Either way, fascinating case of auditory mimicry.

...I mean Meow.