The source of the phrase quoted in the OP has a fascenating background in the OT. The first time the scripture uses this phrase is in Deuteronomy. It occurs several places in Deuteronomy, but the most significant is Deuteronomy 29 and 30.
Deut 30:6 And Jehovah thy God will circumcise thy heart, and the heart of thy seed, to love Jehovah thy God with all thy heart, and with all thy soul, that thou mayest live.
The phrase from the OP is used several places in the NT. Each time it is a quote from one of several places in Deuteronomy. In the above verse, it is noticeable that the person who loves Jehovah is the person God has "circumcised thy heart." God must first do a work in the heart of a person before one can love God.
Deut 29:4 but Jehovah hath not given you a heart to know, and eyes to see, and ears to hear, unto this day.
The concept of eyes to see, ears to hear, is also found quoted in several places in the NT. Paul quotes it in Romans and John quotes it in his gospel. Isaiah also quotes the concept in his prophetic book. This passage tells us the reason Israel failed. They failed because God did not give them a heart to obey. In this verse it is obvious that God does not give a universal preceding (prevenient) work of Grace. God did not change the heart of each and every individual Israelite. With some Israelites he left them alone with their sin to harden their hearts.
Deuteronomy 30:1-2 has some other concepts. One must also grasp the curses and blessings of Deuteronomy. You would have to read the material in Deuteronomy 27-28 to have a handle of the blessings and cursings. I will assume the reader knows what I am talking about.
1 And it shall come to pass, when all these things are come upon thee, the blessing and the curse, which I have set before thee, and thou shalt call them to mind among all the nations, whither Jehovah thy God hath driven thee,
2 and shalt return unto Jehovah thy God, and shalt obey his voice according to all that I command thee this day, thou and thy children, with all thy heart, and with all thy soul;
Notice in verse 1 that Israel will call the cursings and blessings to mind when they are scattered among the nations. This assumes that Israel will be under the cursings. This connects chapter 30 back to 29:4. God did not give Israel a heart to obey him, therefore they were scattered and came under the curses of Deuteronomy.
The curses come upon the one who fails in any of the laws.
Deut 27:26 Cursed be he that confirmeth not the words of this law to do them. And all the people shall say, Amen.
Paul uses this verse in Galatians 3:10 to prove the falicy that a person can obey the Law of God on his own.
10 For as many as are of the works of the law are under a curse: for it is written, Cursed is every one who continueth not in all things that are written in the book of the law, to do them.
The one who loves God with all his heart, is the same one who obey's all the words of the Law without error.
Of course all this points forward to the work of Christ. Only Christ fulfilled all the law with his righteous death, and then died that substitutionary death. Christ was the one who would bring about the change of heart, and then save those to whom he gives his salvation.
This post barely scratches the surface of the depth of the wonderful work of God found in Deuteronomy, and specifically the phrase "love the Lord thy God with all thy heart." When the Lawyer in Luke 10 (parable of good samaratin) quoted this passage as that which saves, Christ answered that the Lawyer was correct, "Do this and thou shalt live."