The word 'build' (or 'rebuilt) here comes from the Hebrew word 'banah', which means 'repair, restore'. Notice the word 'again' here? Yes, He can do a miracle and build you again. And if He can restore the glory of 'virginity' again in His people, there's nothing that He cannot do for your life, no matter what had happened, or what mistake (or mistakes) you have made recently.
Though this chapter (Jeremiah 31) speaks about the nation of Israel, it is also applicable to you, because you too are God's precious child. And if you will return to Him, there is forgiveness for you. Sorrows will be turned to joy, and mourning into dancing. 'Tambourines' here speaks of 'joy and celebration', and He wants you to be 'adorned' with such again.
The word 'virgin' here has spiritual meaning, not just literal (or physical) meaning. There are two Hebrew words for the word 'virgin' in the Bible, namely 'bethuwlah' (see Genesis 24:16) and 'almah' (see Genesis 24:43). In Jeremiah 31:4, this word 'virgin' is 'bethuwlah', from the root word meaning 'separated', and implies 'something so precious, like a treasure (or a rare, hidden gem)'.
In Christ, you too are separated unto God (i.e. made holy), 'precious, like a treasure (or a rare, hidden gem)' in His eyes. You may not think so (how precious and valuable you are), but the truth is this is how God sees you today - washed by the Blood of Jesus, made holy, precious, like a treasure (or a rare, hidden gem), and bought with the price of His own Son!
The word 'restore' here speaks of 'returning to the starting (original) point (where one is supposed to be), or receiving back something that was lost'. The word 'Ephraim' here is from the word 'Ephrathah' in Hebrew, meaning 'fruitfulness'. As God's precious child, you too are supposed to be fruitful in all that you are (or do). This is His original plan for you!
Know also that no matter what mistake (or mistakes) you have made in life, He still loves you. And the Bible says He loves you with an everlasting love (Jeremiah 31:3). In fact, He loves you so much that He's willing to carry them all just for you! All the sins, the cross, the shame! (Isaiah 53:3-5)
In Luke 5:17-26, a group of men brought on a bed a man who was paralyzed, whom they sought to bring in and lay before Jesus. And when they could not find how they might bring him in, because of the crowd, they went up on the housetop and let him down with his bed through the roof (tiling) into the midst before Jesus. And when He saw their faith, He said to this paralyzed man, "Man, your sins are forgiven you." He then said to this man, "I say to you, arise, take up your bed, and go to your house.", and immediately this man was being restored and made whole, to be who he was supposed to be.
As you can see above, God's restoration work flows easily when you know that in Christ, you are already forgiven (Ephesians 1:7). Forgiveness leads to healing and restoration. As you receive your forgiveness, may you also forgive yourself and forgive others, so that your prayers will not be hindered (Mark 11:23-25). And if you find it hard to forgive, trust that He will help you. Philippians 2:13 says, '... for it is God who works in you both to will and to do for His good pleasure'. Amen.