Had World War II not erupted, the Cold War might not have erupted; however the aftermath of the war was such that Cold War was inevitable.
The Capitalist West and Communist East held philosophies which were both opposite and antagonistic to each other. They were forced allies during the war, and fought against the same enemy rather than with each other. The Soviet invasion of areas held by Germany gave them a foothold in Eastern Europe which they refused to abandon. Additionally, Joseph Stalin saw the war as continuing on a different front, this time against Capitalism rather than German totalitarianism. Additionally, the need to bring the war against Japan to a quick conclusion led the U.S. to employ nuclear weapons for the firs time, and thus introduce the nuclear era to world affairs. Had the war not happened, Germany and much of eastern Europe would have provided a convenient buffer between East and West. Additionally, without the war, the development of the Atomic Bomb may have been obviated. Since none of this happened, however, it appears safe to say that the Cold War was inevitable.