Constructing quantum vertex algebras