Your question seems a bit imprecise. Why do you want to have them, and what do you mean by having them, "in a tree" ?
The table you've got IS (the relational way to represent) the tree.
If you want them "in a table" with rows that hold the pairs (ID 4 , ParentID 0), then you need your SQL engine's version of recursive SQL to do this, if that engine supports it.
I wouldn't know about MySQL specifically, but my understanding is that they once planned to implement recursive SQL using the same syntax as Oracle, i.e. with CONNECT BY.
If you look in your manual's table of contents for keywords such as "recursive queries" or "CONNECT BY", I imagine you should be able to find the answer.
(Sorry for not being able to provide a more ready-to-consume answer.)