Take the first part of each filename (separated by '_') from all the files ending with .txt, and use it to search for the corresponding line in each file ending with _data.txt.
cat <(cut -d'_' -f1 <(ls *.txt)) | xargs -I{} grep {} {}_data.txt