How could Adam and Eve have known not to eat from the Tree of Good and Evil? How could Adam and Eve have known not to eat from the Tree of Good and Evil? As it was said that Adam and Eve did not know right from wrong. 
Genesis 3:22:


  And the LORD God said, "The man has now become like one of us, knowing good and evil. He must not be allowed to reach out his hand and take also from the tree of life and eat, and live forever."


With that said God also said that if they were to eat from the Tree than they would surely die:
Genesis 2:17


  but you must not eat from the tree of the knowledge of good and evil, for when you eat of it you will surely die."


He was told by God not to eat from it or he shall die. But, without the knowledge of what is Good and what is Bad how would have have known that disobeying God was bad?
First, be careful not to conflate the Tree of Life with the Tree of Knowledge of Good and Evil.  The Genesis narrative makes it clear that they are two different trees, and are in fact in opposition to each other:


  He must not be allowed to reach out his hand and take also from the Tree of Life and eat, and live forever.


As for the answer to the question, the tree of knowledge could give Adam and Eve knowledge of good and evil in general, but that doesn't mean that they had no concept beforehand that there was something wrong with disobeying God in matters in which they had been given a direct commandment.