"You will know them by their fruits. Do men gather grapes from thornbushes or figs from thistles? Even so, every good tree bears good fruit, but a bad tree bears bad fruit." [Matt 7:16-17]
There are certain kinds of plants that we know are dangerous, such as death caps or lima beans (safe when cooked, but raw they contain a toxin that can make you violently ill in a very small quantity). Anybody who is aware of the dangers of these types of plants knows not to eat them. They don't stumble upon a death cap one day and think "I wonder if it's safe to eat this time."
Likewise some plants are beneficial such as strawberry bushes or olive vines. These plants bear fruit that are good to eat and are always good to eat. You can know by looking at the fruit that they produce that they are good and healthy without having to test each one.
There are many people who profess to be children of God but either do not produce good fruits, that is good works, or in some cases even produce bad fruits. They live sinful lifestyles, are involved in sinful relationships, or conduct themselves in ways that are not in keeping with God's word. We cannot be children of God if the fruit that we produce is rotten or bitter or poisonous.
In John 15 Jesus said that he is the true vine. Like an olive branch that produces fruit that is good to eat, those who truly follow Jesus, who are branches on His vine, should produce only good fruit, or good works. We should be holy, meaning different from the world; set apart from sin. If the fruit that we bare is bad, if we walk in the ways of the world, then we cannot be one with Christ anymore than a deadly death cap can grow from an olive branch.