There are some conditions that guarantee that the fundamental group of a space will be abelian. For example, if the fundamental group of an H-space is abelian. In these cases, the first homology group will be isomorphic to the fundamental group (if the space is path connected).
Otherwise, if you're only given the data of $H_1(X)$, you cannot compute $\pi_1(X)$ from that. The reason is simple: if you're given the abelianization of a group $G_{ab}$, the group $G$ could be pretty much anything. It could be the product of $G_{ab}$ with a perfect group, or some other extension of $G$...
To give you an example, a knot in $\mathbb{R}^3$ is almost determined by the fundamental group of its complement (as far as I remember, you also need to specify some orientation -- a knot theorist could correct me if I remember incorrectly). But it's also a theorem that the first homology group of this complement is always $\mathbb{Z}$! Even though knot complements are very well-behaved spaces, you still get a lot with the same first homology group.
In fact the noncommutativity of $\pi_1$ can lead to "strange" situations. For example, if the fundamental group is abelian, then trivial homology ($\tilde{H}_*(X) = 0$) implies trivial homotopy ($\pi_*(X) = 0$). But when the fundamental group is not abelian, then it's not true anymore, and there are in fact tons of so-called acyclic spaces whose homology vanish but who are not contractible. Their fundamental group will be perfect because of the Hurewicz isomorphism, but after that (almost) all bets are off. See for example Acyclic spaces by Dror Farjoun. So not even the whole homology of a space is enough to determine the fundamental group if you don't know that it's abelian.
Another example of possible condition is "$X$ is a co-H-space". The fundamental group of $X$ is then free, so the rank of the abelianization is enough to find $\pi_1$ up to isomorphism. I think you can even find the generators by considering lifts of generators of $H_1$.
This is a partial answer.
For any abelian group $G$ and integer $n \geq 1$, there is a CW complex $M(G, n)$ such that
$$\tilde{H}_i(M(G, n)) = \begin{cases}
G & i = n\\
0 & i \neq n
\end{cases}$$
called a Moore space. Moreover, for $n > 1$, we can take these spaces to be simply connected. See Example $2.40$ of Hatcher's Algebraic Topology.
Using the fact that $H_n(\bigvee_{\alpha}X_{\alpha}) = \bigoplus_{\alpha}H_n(X_{\alpha})$, we see that for a given sequence of abelian groups $\{G_n\}_{n=1}^{\infty}$, the CW complex $X = \bigvee_{n=1}^{\infty}M(G_n, n)$ has the property that $H_i(X) = G_i$.
However, all that can be said of $\pi_1(X)$ is that its abelianisation is $G_1$. There are many different groups with the same abelianisation, so $\pi_1(X)$ may not be the group you wanted it to be.
If one could construct the Moore spaces $M(G, 1)$ with a given fundamental group (which must satisfy the necessary condition that its abelianisation is $G$), then the above space would have the desired properties. However, I don't know if this has been done.
Added Later: I asked a separate question about this final point (whether one could construct a Moore space $M(G, 1)$ with given fundamental group) here. It turns out it is not always possible.
Best Answer
The Poincare homology sphere has the same homology as the $3$ sphere but a nontrivial fundamental group.