A finitely generated group acting on a tree so that all vertex and edge stabilizers are infinite cyclic groups is called a generalized Baumslag–Solitar group (a GBS group). Every GBS group is the fundamental group Π1(A) of a suitable labeled graph A. We prove that if A and B are labeled trees, then the groups Π1(A) and Π1(B) are universally equivalent iff Π1(A) and Π1(B) are embeddable into each other. An algorithm for verifying universal equivalence is pointed out. Moreover, we specify simple conditions for checking this criterion in the case where the centralizer dimension is equal to 3.