These two parables are pretty similar. They both described the kingdom of heaven as something very precious, and those who found it are willing to sell all their properties to buy this treasure.
In the first parable, the treasure hidden in the field was accidentally found. Just like many people who were not actively searching in life, yet Jesus enters into their lives, converted their hearts, and turned their lives around.
In the second parable, the merchant was actively seeking for fine pearls. It is like many people who have an inner desire to seek something better in life, whether it is the thirst for God's presence, truth, justice, or the meaning of life. He may not even know what it is that he is searching; it's just that he is not satisfied by things in this world. When he finally found it, he would know, and he'd give up everything just to obtain it.
While the intentions might be different, it is important to note that people who found this treasure have to give up everything they had to secure it. Therefore it is a hint to us, that there is a price to pay to enter the kingdom of heaven. Although the gift of salvation is freely given to us, God needs our cooperation to accept it, to let go of our sinful lives, and be transformed by His grace. As Jesus said: "Repent, for the kingdom of heaven is at hand."
Jesus is showing us the way into the kingdom of heaven, to have eternal life; nothing is more important than that. Are you willing to give up everything for it?