It is one of those proverbs that must go way back in history. The dog was first domesticated some 14,000 years ago, so the thought must go back a long ways. In English, it was first cited in Great Britain in 1709 and in the United States in Girl in Black (1927) by V. Bridges.