A necessary condition is that, for every word $w(x,y)$ in two letters, we have $${\rm Tr}w(A_i',A_i)={\rm Tr}(B_i',B_i).$$ If $r=1$ (one pair only), this condition is also sufficient; this is Specht's Theorem. Notice that the symmetry assumption is not important here. In the present case, a necessary condition is that for every word $w$ in $2r$ letters, one has $$w(A_1,A_1',\ldots,A_r,A_r')=w(B_1,B_1',\ldots,B_r,B_r').$$ Whether it is also a sufficient condition is unclear to me.