Hodge Classes and the Jacquet-Langlands Correspondence